/*
 * ProjetoPSA - Plano de Substituição de Aulas
 *    Copyright (C) 2010  Marcelo e Cicero
 *
 *    This program is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projetoPSA;

import java.text.ParseException;
import java.util.Date;
import projetoPSA.facades.*;
import projetoPSA.pojos.*;
import projetoPSA.utils.DateUtils;
import projetoPSA.utils.EnumDateFormat;

/**
 *
 * @author Marcelo e Cicero
 */
public class Popular {

    public static void popula() throws ParseException, Exception {
        new ProfessorFacade(new Professor(null, null, null, "Reginaldo Ré", "REGINALDO", null)).persist();
        new ProfessorFacade(new Professor(null, null, null, "André Luiz Satoshi Kawamoto", "ANDRE", null)).persist();
        new ProfessorFacade(new Professor(null, null, null, "Rogério Aparecido Gonçalves", "ROGERIO", null)).persist();
        new ProfessorFacade(new Professor(null, null, null, "Igor Scaliante Wiese", "IGOR", null)).persist();
        new ProfessorFacade(new Professor(null, null, null, "Marco Aurélio Lopes Barbosa", "MARCOS", null)).persist();
        new ProfessorFacade(new Professor(null, null, null, "Frank Helbert Borsato", "FRANK", null)).persist();
        new ProfessorFacade(new Professor(null, null, null, "Marcos Silvano Orita Almeida", "SILVANO", null)).persist();

        new TurmaFacade(new Turma(null, null, "NE3A", "3º Semestre")).persiste();

        new SalaFacade(new Sala("E101", "Laboratorio de informatica I", null)).persiste();
        new SalaFacade(new Sala("E105", "Laboratorio de informatica V", null)).persiste();
        new SalaFacade(new Sala("E003", "Sala de Aula III", null)).persiste();
        new SalaFacade(new Sala("E100", "Laboratorio de informatica", null)).persiste();

        new DisciplinaFacade(new Disciplina(null, null, "CP33A", "Construção de Paginas WEB III", 3)).persiste();
        new DisciplinaFacade(new Disciplina(null, null, "PI33A", "Projeto Integrador", 5)).persiste();
        new DisciplinaFacade(new Disciplina(null, null, "SO33A", "Sistemas Operacionais", 3)).persiste();
        new DisciplinaFacade(new Disciplina(null, null, "RC33A", "Redes de Computadores I", 4)).persiste();
        new DisciplinaFacade(new Disciplina(null, null, "EN33A", "Engenharia de Software I", 3)).persiste();
        new DisciplinaFacade(new Disciplina(null, null, "BD33A", "Banco de Dados II", 4)).persiste();
        new DisciplinaFacade(new Disciplina(null, null, "LP33A", "Linguagem de Programação II", 3)).persiste();

        setHorario("18:50","19:40");
        setHorario("19:40","20:30");
        setHorario("20:30","21:20");
        setHorario("21:30","22:15");
        setHorario("22:15","23:00");

        new DiaSemanaFacade(new DiaSemana("SEG", "Segunda Feira", null)).persiste();
        new DiaSemanaFacade(new DiaSemana("TER", "Terça Feira", null)).persiste();
        new DiaSemanaFacade(new DiaSemana("QUA", "Quarta Feira", null)).persiste();
        new DiaSemanaFacade(new DiaSemana("QUI", "Quinta Feira", null)).persiste();
        new DiaSemanaFacade(new DiaSemana("SEX", "Sexta Feira", null)).persiste();

        new CursoFacade(new Curso("TSI", "Tecnologia em Sistemas para Internet", new Date(), null)).persiste();

    }

    private static void setHorario(String entrada, String saida) throws ParseException, Exception{
        Date e = new DateUtils().string4Date(entrada,EnumDateFormat.TIME_SIMPLE);
        Date s = new DateUtils().string4Date(saida,EnumDateFormat.TIME_SIMPLE);

        new HorarioFacade(new Horario(null, null, e, s)).persiste();

    }



}
